#!/bin/sh

echo "Waiting for bundle installation and db setup to finish..."
touch tmp/.seeding_status
(tail -f -n0 tmp/.seeding_status & ) | timeout 240 grep -q done

if [ ! $? -eq 0 ]
then
  echo "DB not ready"

  exit 1
fi

rm -rf tmp/*

bundle exec rails server thin -b 0.0.0.0
